package xidian.bdilab.k8s.demo;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.net.InetAddress;
import java.net.UnknownHostException;

@Controller
public class DemoController {
    @RequestMapping("/equipment")
    public String getPage() {

        return "equipment.html";
    }
    @RequestMapping("/getversion")
    public ResponseEntity<String> getVersion() {

        return ResponseEntity.ok("v1");
    }

    @GetMapping("/getip")
    public ResponseEntity<String> getIp() throws UnknownHostException {

        return ResponseEntity.ok(InetAddress.getLocalHost().getHostAddress());
    }
}
